package com.cm.caseManagement.service.impl;


import com.cm.caseManagement.dao.CmLoansTypeMapper;
import com.cm.caseManagement.pojo.entity.CmLoansType;
import com.cm.caseManagement.service.ICmLoansTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cm.caseManagement.utils.DateUtils;

import java.util.List;

/**
 * 贷款种类Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmLoansTypeServiceImpl implements ICmLoansTypeService
{
    @Autowired
    private CmLoansTypeMapper cmLoansTypeMapper;

    /**
     * 查询贷款种类
     *
     * @param id 贷款种类主键
     * @return 贷款种类
     */
    @Override
    public CmLoansType selectCmLoansTypeById(Long id)
    {
        return cmLoansTypeMapper.selectCmLoansTypeById(id);
    }

    /**
     * 查询贷款种类列表
     *
     * @param cmLoansType 贷款种类
     * @return 贷款种类
     */
    @Override
    public List<CmLoansType> selectCmLoansTypeList(CmLoansType cmLoansType)
    {
        return cmLoansTypeMapper.selectCmLoansTypeList(cmLoansType);
    }

    /**
     * 新增贷款种类
     *
     * @param cmLoansType 贷款种类
     * @return 结果
     */
    @Override
    public int insertCmLoansType(CmLoansType cmLoansType)
    {
        cmLoansType.setCreateTime(DateUtils.getNowDate());
        return cmLoansTypeMapper.insertCmLoansType(cmLoansType);
    }

    /**
     * 修改贷款种类
     *
     * @param cmLoansType 贷款种类
     * @return 结果
     */
    @Override
    public int updateCmLoansType(CmLoansType cmLoansType)
    {
        cmLoansType.setUpdateTime(DateUtils.getNowDate());
        return cmLoansTypeMapper.updateCmLoansType(cmLoansType);
    }

    /**
     * 批量删除贷款种类
     *
     * @param ids 需要删除的贷款种类主键
     * @return 结果
     */
    @Override
    public int deleteCmLoansTypeByIds(Long[] ids)
    {
        return cmLoansTypeMapper.deleteCmLoansTypeByIds(ids);
    }

    /**
     * 删除贷款种类信息
     *
     * @param id 贷款种类主键
     * @return 结果
     */
    @Override
    public int deleteCmLoansTypeById(Long id)
    {
        return cmLoansTypeMapper.deleteCmLoansTypeById(id);
    }
}
